package com.timmy.test1.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.timmy.test1.R;

/**
 * Created by timmy on 2020/5/7.
 */

public class CustomRoundView extends CustomKeyView {
    public boolean isRound = true;

    public Drawable mNormalBackground;

    public int mNormalBackgroundId;

    public Drawable mPressBackground;

    public int mPressBackgroundId;

    public CustomRoundView(Context paramContext) {
        this(paramContext, (AttributeSet) null);
    }

    public CustomRoundView(Context paramContext, AttributeSet paramAttributeSet) {
        this(paramContext, paramAttributeSet, 0);
    }

    public CustomRoundView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
        super(paramContext, paramAttributeSet, paramInt);
        init(paramContext, paramAttributeSet);
    }

    private void init(Context paramContext, AttributeSet paramAttributeSet) {
        if (paramAttributeSet != null) {
            TypedArray typedArray = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.RoundView);
            this.mNormalBackground = typedArray.getDrawable(R.styleable.RoundView_normalBackground);
            this.mPressBackground = typedArray.getDrawable(R.styleable.RoundView_pressBackground);
            this.isRound = typedArray.getBoolean(R.styleable.RoundView_isRound, true);
            typedArray.recycle();
        }
        if (this.isRound) {
            post(new Runnable() {
                @Override
                public void run() {
                    if (CustomRoundView.this.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
                        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams((RelativeLayout.LayoutParams) CustomRoundView.this.getLayoutParams());
                        layoutParams.height = layoutParams.width;
                        CustomRoundView.this.setLayoutParams((ViewGroup.LayoutParams) layoutParams);
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.append("rv post ");
                        stringBuilder.append(CustomRoundView.this.getText());
                        stringBuilder.append(" ");
                        stringBuilder.append(CustomRoundView.this.getWidth());
                        stringBuilder.append(" ");
                        stringBuilder.append(CustomRoundView.this.getHeight());
//                        Timber.e(stringBuilder.toString(), new Object[0]);
                        return;
                    }
                    if (CustomRoundView.this.getLayoutParams() instanceof LinearLayout.LayoutParams) {
                        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams((LinearLayout.LayoutParams) CustomRoundView.this.getLayoutParams());
                        layoutParams.height = layoutParams.width;
                        CustomRoundView.this.setLayoutParams(layoutParams);
                    }
                }
            });
        }
    }

    public boolean isRound() {
        return this.isRound;
    }

    public void setNormalBackground(int paramInt) {
        this.mNormalBackgroundId = paramInt;
        this.mNormalBackground = getResources().getDrawable(paramInt);
        invalidate();
    }

    public void setPressBackground(int paramInt) {
        this.mPressBackgroundId = paramInt;
        this.mPressBackground = getResources().getDrawable(paramInt);
        invalidate();
    }

    public void setRound(boolean paramBoolean) {
        this.isRound = paramBoolean;
    }

    @Override
    public void setScanCode(int paramInt) {
        super.setScanCode(paramInt);
        String str = "Shift";
        switch (paramInt) {
            case 87:
                str = "F11";
                break;
            case 88:
                str = "F12";
                break;
            case 219:
                str = "Win";
                break;
            case 111:
                str = "Del";
                break;
            case 110:
                str = "Ins";
                break;
            case 109:
                str = "PgDn";
                break;
            case 108:
                str = "↓";
                break;
            case 107:
                str = "Home";
                break;
            case 106:
                str = "→";
                break;
            case 105:
                str = "←";
                break;
            case 104:
                str = "PgUp";
                break;
            case 103:
                str = "↑";
                break;
            case 102:
                break;
            case 68:
                str = "F10";
                break;
            case 67:
                str = "F9";
                break;
            case 66:
                str = "F8";
                break;
            case 65:
                str = "F7";
                break;
            case 64:
                str = "F6";
                break;
            case 63:
                str = "F5";
                break;
            case 62:
                str = "F4";
                break;
            case 61:
                str = "F3";
                break;
            case 60:
                str = "F2";
                break;
            case 59:
                str = "F1";
                break;
            case 58:
                str = "Caps";
                break;
            case 57:
                str = "Space";
                break;
            case 53:
                str = "/";
                break;
            case 52:
                str = ".";
                break;
            case 51:
                str = ",";
                break;
            case 50:
                str = "m";
                break;
            case 49:
                str = "n";
                break;
            case 48:
                str = "b";
                break;
            case 47:
                str = "v";
                break;
            case 46:
                str = "c";
                break;
            case 45:
                str = "x";
                break;
            case 44:
                str = "z";
                break;
            case 43:
                str = "\\";
                break;
            case 41:
                str = "`";
                break;
            case 40:
                str = "'";
                break;
            case 39:
                str = ";";
                break;
            case 38:
                str = "l";
                break;
            case 37:
                str = "k";
                break;
            case 36:
                str = "j";
                break;
            case 35:
                str = "h";
                break;
            case 34:
                str = "g";
                break;
            case 33:
                str = "f";
                break;
            case 32:
                str = "d";
                break;
            case 31:
                str = "s";
                break;
            case 30:
                str = "a";
                break;
            case 29:
                str = "Ctrl";
                break;
            case 28:
                str = "Enter";
                break;
            case 27:
                str = "]";
                break;
            case 26:
                str = "[";
                break;
            case 25:
                str = "p";
                break;
            case 24:
                str = "o";
                break;
            case 23:
                str = "i";
                break;
            case 22:
                str = "u";
                break;
            case 21:
                str = "y";
                break;
            case 20:
                str = "t";
                break;
            case 19:
                str = "r";
                break;
            case 18:
                str = "e";
                break;
            case 17:
                str = "w";
                break;
            case 16:
                str = "q";
                break;
            case 15:
                str = "Tab";
                break;
            case 14:
                str = "Back";
                break;
            case 13:
                str = "=";
                break;
            case 12:
                str = "-";
                break;
            case 11:
                str = "0";
                break;
            case 10:
                str = "9";
                break;
            case 9:
                str = "8";
                break;
            case 8:
                str = "7";
                break;
            case 7:
                str = "6";
                break;
            case 6:
                str = "5";
                break;
            case 5:
                str = "4";
                break;
            case 4:
                str = "3";
                break;
            case 3:
                str = "2";
                break;
            case 2:
                str = "1";
                break;
            case 1:
                str = "Esc";
                break;
            default:
                str = "";
                break;
        }
        switch (paramInt) {
            case 87:
                str = "F11";
                break;
            case 88:
                str = "F12";
                break;
            case 219:
                str = "Win";
                break;
            case 111:
                str = "Del";
                break;
            case 110:
                str = "Ins";
                break;
            case 109:
                str = "PgDn";
                break;
            case 108:
                str = "↓";
                break;
            case 107:
                str = "Home";
                break;
            case 106:
                str = "→";
                break;
            case 105:
                str = "←";
                break;
            case 104:
                str = "PgUp";
                break;
            case 103:
                str = "↑";
                break;
            case 102:
                break;
            case 68:
                str = "F10";
                break;
            case 67:
                str = "F9";
                break;
            case 66:
                str = "F8";
                break;
            case 65:
                str = "F7";
                break;
            case 64:
                str = "F6";
                break;
            case 63:
                str = "F5";
                break;
            case 62:
                str = "F4";
                break;
            case 61:
                str = "F3";
                break;
            case 60:
                str = "F2";
                break;
            case 59:
                str = "F1";
                break;
            case 58:
                str = "Caps";
                break;
            case 57:
                str = "Space";
                break;
            case 53:
                str = "/";
                break;
            case 52:
                str = ".";
                break;
            case 51:
                str = ",";
                break;
            case 50:
                str = "m";
                break;
            case 49:
                str = "n";
                break;
            case 48:
                str = "b";
                break;
            case 47:
                str = "v";
                break;
            case 46:
                str = "c";
                break;
            case 45:
                str = "x";
                break;
            case 44:
                str = "z";
                break;
            case 43:
                str = "\\";
                break;
            case 41:
                str = "`";
                break;
            case 40:
                str = "'";
                break;
            case 39:
                str = ";";
                break;
            case 38:
                str = "l";
                break;
            case 37:
                str = "k";
                break;
            case 36:
                str = "j";
                break;
            case 35:
                str = "h";
                break;
            case 34:
                str = "g";
                break;
            case 33:
                str = "f";
                break;
            case 32:
                str = "d";
                break;
            case 31:
                str = "s";
                break;
            case 30:
                str = "a";
                break;
            case 29:
                str = "Ctrl";
                break;
            case 28:
                str = "Enter";
                break;
            case 27:
                str = "]";
                break;
            case 26:
                str = "[";
                break;
            case 25:
                str = "p";
                break;
            case 24:
                str = "o";
                break;
            case 23:
                str = "i";
                break;
            case 22:
                str = "u";
                break;
            case 21:
                str = "y";
                break;
            case 20:
                str = "t";
                break;
            case 19:
                str = "r";
                break;
            case 18:
                str = "e";
                break;
            case 17:
                str = "w";
                break;
            case 16:
                str = "q";
                break;
            case 15:
                str = "Tab";
                break;
            case 14:
                str = "Back";
                break;
            case 13:
                str = "=";
                break;
            case 12:
                str = "-";
                break;
            case 11:
                str = "0";
                break;
            case 10:
                str = "9";
                break;
            case 9:
                str = "8";
                break;
            case 8:
                str = "7";
                break;
            case 7:
                str = "6";
                break;
            case 6:
                str = "5";
                break;
            case 5:
                str = "4";
                break;
            case 4:
                str = "3";
                break;
            case 3:
                str = "2";
                break;
            case 2:
                str = "1";
                break;
            case 1:
                str = "Esc";
                break;
            default:
                str = "";
                break;
        }
        setText(str);
    }
}


/* Location:              C:\Users\timmy\Documents\Tencent Files\825125501\FileRecv\0xcfd85000-dex2jar.jar!\cn\ji_cloud\android\views\CustomRoundView.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */